home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / xvisrc.zip / OS2VIO.H < prev    next >
C/C++ Source or Header  |  1992-07-28  |  4KB  |  169 lines

  1. /* Copyright (c) 1990,1991,1992 Chris and John Downey */
  2. /***
  3. * @(#)os2vio.h    2.1 (Chris & John Downey) 7/29/92
  4.  
  5. * program name:
  6.     xvi
  7. * function:
  8.     PD version of UNIX "vi" editor, with extensions.
  9. * module name:
  10.     os2vio.h
  11. * module function:
  12.     Definitions for OS/2 system interface.
  13. * history:
  14.     STEVIE - ST Editor for VI Enthusiasts, Version 3.10
  15.     Originally by Tim Thompson (twitch!tjt)
  16.     Extensive modifications by Tony Andrews (onecom!wldrdg!tony)
  17.     Heavily modified by Chris & John Downey
  18.  
  19. ***/
  20.  
  21. /*
  22.  * System include files.
  23.  */
  24. #define INCL_BASE
  25. #define INCL_DOS
  26. #define INCL_SUB
  27. #define INCL_DOSERRORS
  28.  
  29. #include <os2.h>
  30.  
  31. /*
  32.  * Include files for Microsoft C library.
  33.  */
  34. #include <fcntl.h>
  35. #include <malloc.h>
  36. #include <process.h>
  37. #include <stdlib.h>
  38. #include <time.h>
  39. #ifndef SIGINT
  40. #   include <signal.h>
  41. #endif
  42.  
  43. /*
  44.  * This is a multi-thread program, so we allocate multiple stacks
  45.  * within the same stack segment, so there isn't much point in letting
  46.  * the compiler put in stack probes.
  47.  */
  48. #pragma check_stack(off)
  49.  
  50. #ifndef HELPFILE
  51. #   define HELPFILE    "d:\\jmd\\xvi\\help"
  52. #endif
  53.  
  54. /*
  55.  * System-dependent constants.
  56.  *
  57.  * These are right for MS-DOS & (I think) OS/2. (jmd)
  58.  */
  59. #define    MAXPATHLEN    143    /* maximum length of full path name */
  60. #define    MAXNAMLEN    12    /* maximum length of file name */
  61. #define    DIRSEPS        "\\/"    /*
  62.                  * directory separators within
  63.                  * pathnames
  64.                  */
  65.  
  66. /*
  67.  * Under OS/2, characters with the top bit set are perfectly valid
  68.  * (although not necessarily always what you want to see).
  69.  */
  70. #define    DEF_CCHARS    TRUE
  71. #define    DEF_MCHARS    TRUE
  72.  
  73. #define    SETVBUF_AVAIL
  74. #define    WRTBUFSIZ    0x7000
  75. #define    READBUFSIZ    0x7000
  76.  
  77. extern unsigned        Rows, Columns;
  78. extern unsigned char    virt_row, virt_col;
  79. extern unsigned char    curcell[2];
  80.  
  81. /*
  82.  * Default value for P_format parameter.
  83.  */
  84. #define DEF_TFF        fmt_OS2
  85.  
  86. /*
  87.  * Terminal driving functions - just use macros here.
  88.  */
  89. #define insert_line()        /* insert one line */
  90. #define delete_line()        /* delete one line */
  91. #define save_cursor()        /* save cursor position */
  92. #define restore_cursor()    /* restore cursor position */
  93. #define invis_cursor()        /* invisible cursor */
  94. #define vis_cursor()        /* visible cursor */
  95. #define tty_goto(r,c)    (virt_row = (r), virt_col = (c))
  96. #define cost_goto    0    /* cost of using tty_goto() */
  97.  
  98. /*
  99.  * Update actual screen cursor position. This is the only output flushing we
  100.  * need to do, because outstr() & outchar() use system calls which update
  101.  * video memory directly.
  102.  */
  103. #define flush_output()    VioSetCurPos(virt_row, virt_col, 0)
  104.  
  105. #define can_ins_line    FALSE
  106. #define can_del_line    FALSE
  107. #define can_scroll_area TRUE
  108. /*
  109.  * tty_linefeed() isn't needed if can_scroll_area is TRUE.
  110.  */
  111. #define tty_linefeed()
  112.  
  113. #define can_inschar    FALSE
  114. #define inschar(c)
  115.  
  116. #define set_colour(a)    (curcell[1] = (a))
  117. /*
  118.  * User-definable screen colours. Default values are for mono
  119.  * displays.
  120.  */
  121. #define DEF_COLOUR    7
  122. #define DEF_STCOLOUR    112
  123. #define DEF_SYSCOLOUR    7
  124.  
  125. #define alert()        DosBeep(2000, 150)
  126.  
  127. /*
  128.  * Macros to open files in binary mode,
  129.  * and to expand filenames.
  130.  */
  131. #define fopenrb(f)    fopen((f),"rb")
  132. #define fopenwb(f)    fopen((f),"wb")
  133. #define fexpand(f)    (f)
  134.  
  135. /*
  136.  * exists(): TRUE if file exists.
  137.  */
  138. #define exists(f)    (access((f),0) == 0)
  139. /*
  140.  * can_write(): TRUE if file does not exist or exists and is writeable.
  141.  */
  142. #define can_write(f)    (access((f),0) != 0 || access((f), 2) == 0)
  143. #define delay()        DosSleep((long) 200)
  144. #define call_shell(s)    spawnlp(P_WAIT, (s), (s), (char *) NULL)
  145. #define call_system(s)    system(s)
  146.  
  147. /*
  148.  * Declarations for system interface routines in os2vio.c.
  149.  */
  150. extern    void        erase_display(void);
  151. extern    void        erase_line(void);
  152. extern    int        inchar(long);
  153. extern    void        outchar(int);
  154. extern    void        outstr(char*);
  155. extern    void        scroll_down(unsigned, unsigned, unsigned);
  156. extern    void        scroll_up(unsigned, unsigned, unsigned);
  157. extern    char        *tempfname(char *);
  158. extern    void        sys_init(void);
  159. extern    void        sys_exit(int);
  160. extern    bool_t        sys_pipe P((char *, int (*)(FILE *), long (*)(FILE *)));
  161. extern    void        sys_startv(void);
  162. extern    void        sys_endv(void);
  163.  
  164. /*
  165.  * in i286.asm:
  166.  */
  167. extern void far            es0(void);
  168. extern unsigned char * far    newstack(int);
  169.